package oracle;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class oraclePractice {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        //练习：JDBC链接oracle--login--增加
        Class.forName("oracle.jdbc.OracleDriver");
        String username="system";  //mysql数据库用户名
        String password ="Jz123456@";    //mysql数据库密码
        String url="jdbc:oracle:thin:@127.0.0.1:1521:XE";
        Connection conn= DriverManager.getConnection(url,username,password);
        System.out.println("测试连接是否成功"+conn);
        String sql="insert into login values(4,'赵六',115)";
        Statement st=conn.createStatement();
        int rows=st.executeUpdate(sql);
        System.out.println("增加"+rows+"记录");
        st.close(); conn.close();
    }
}

